<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">




  
  
  
  

  
    
    
  

  
    
      
    

    
  

  

  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Monda:300,300italic,400,400italic,700,700italic|Roboto Slab:300,300italic,400,400italic,700,700italic|PT Mono:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT">










<meta name="description" content="内容 Flex介绍 基本概念 CSS属性说明 Flex项目属性 兼容性  弹性布局： Flex介绍Flex布局，可以简便、完整、响应式地实现各种页面布局。目前，它已经得到了所有浏览器的支持。Flex是Flexible Box的缩写，意为“弹性布局”，用来为盒状模型提供最大的灵活性。 基本概念采用Flex布局的元素为，称为 Flex容器，容器的直接子元素称为 Flex项目，容器默认有两个轴心线，用于">
<meta property="og:type" content="article">
<meta property="og:title" content="flex学习">
<meta property="og:url" content="http://blog.xiaowuzi.info/2015/04/08/flex学习/index.html">
<meta property="og:site_name" content="小武子博客">
<meta property="og:description" content="内容 Flex介绍 基本概念 CSS属性说明 Flex项目属性 兼容性  弹性布局： Flex介绍Flex布局，可以简便、完整、响应式地实现各种页面布局。目前，它已经得到了所有浏览器的支持。Flex是Flexible Box的缩写，意为“弹性布局”，用来为盒状模型提供最大的灵活性。 基本概念采用Flex布局的元素为，称为 Flex容器，容器的直接子元素称为 Flex项目，容器默认有两个轴心线，用于">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://blog.xiaowuzi.info/images/flex/1611cc8a90e05b23.png">
<meta property="og:updated_time" content="2018-04-23T08:10:31.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="flex学习">
<meta name="twitter:description" content="内容 Flex介绍 基本概念 CSS属性说明 Flex项目属性 兼容性  弹性布局： Flex介绍Flex布局，可以简便、完整、响应式地实现各种页面布局。目前，它已经得到了所有浏览器的支持。Flex是Flexible Box的缩写，意为“弹性布局”，用来为盒状模型提供最大的灵活性。 基本概念采用Flex布局的元素为，称为 Flex容器，容器的直接子元素称为 Flex项目，容器默认有两个轴心线，用于">
<meta name="twitter:image" content="http://blog.xiaowuzi.info/images/flex/1611cc8a90e05b23.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://blog.xiaowuzi.info/2015/04/08/flex学习/">





  <title>flex学习 | 小武子博客</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">小武子博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://blog.xiaowuzi.info/2015/04/08/flex学习/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Tony">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="小武子博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">flex学习</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2015-04-08T10:57:46+08:00">
                2015-04-08
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/CSS/" itemprop="url" rel="index">
                    <span itemprop="name">CSS</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="内容"><a href="#内容" class="headerlink" title="内容"></a>内容</h3><ol>
<li>Flex介绍</li>
<li>基本概念</li>
<li>CSS属性说明</li>
<li>Flex项目属性</li>
<li>兼容性</li>
</ol>
<p><strong>弹性布局：</strong></p>
<h3 id="Flex介绍"><a href="#Flex介绍" class="headerlink" title="Flex介绍"></a>Flex介绍</h3><p>Flex布局，可以简便、完整、响应式地实现各种页面布局。目前，它已经得到了所有浏览器的支持。Flex是Flexible Box的缩写，意为“弹性布局”，用来为盒状模型提供最大的灵活性。</p>
<h3 id="基本概念"><a href="#基本概念" class="headerlink" title="基本概念"></a>基本概念</h3><p>采用Flex布局的元素为，称为 <strong>Flex容器</strong>，容器的直接子元素称为 Flex项目，容器默认有两个轴心线，用于项目的对齐与排列，水平主轴为 <strong>main axis</strong>，垂直主轴为 <strong>cross axis</strong>，主轴的开始位置为 <strong>start</strong>， 结束位置为 <strong>end</strong>。</p>
<p><strong>主轴和交叉轴的判定：如果flex-direction为row，则主轴是水平方向，如果是column，则主轴是垂直方向</strong></p>
<p><img src="/images/flex/1611cc8a90e05b23.png" alt=""></p>
<h3 id="CSS属性说明"><a href="#CSS属性说明" class="headerlink" title="CSS属性说明"></a>CSS属性说明</h3><p>将任意元素的 display 属性设置为 flex，可将其转换为Flex容器 设为Flex容器后，子元素的 float、clear 和 vertical-align 属性将失效<br><a id="more"></a></p>
<h4 id="Flex项目属性"><a href="#Flex项目属性" class="headerlink" title="Flex项目属性"></a>Flex项目属性</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">主轴方向：水平排列（默认） | 水平反向排列 | 垂直排列 | 垂直反向排列</span><br><span class="line">flex-direction: row | row-reverse | column | column-reverse;</span><br><span class="line"></span><br><span class="line">换行：不换行（默认） | 换行 | 反向换行(第一行在最后面)</span><br><span class="line">flex-wrap: nowrap | wrap | wrap-reverse;</span><br><span class="line"></span><br><span class="line">flex-direction属性和flex-wrap属性的简写形式，默认值为row nowrap</span><br><span class="line">flex-flow: &lt;flex-direction&gt; || &lt;flex-wrap&gt;;</span><br><span class="line"></span><br><span class="line">主轴对齐方式：起点对齐（默认） | 终点对齐 | 居中对齐 | 两端对齐 | 分散对齐</span><br><span class="line">justify-content: flex-start | flex-end | center | space-between | space-around;</span><br><span class="line"></span><br><span class="line">交叉轴对齐方式：拉伸对齐（默认） | 起点对齐 | 终点对齐 | 居中对齐 | 第一行文字的基线对齐</span><br><span class="line">align-items: stretch | flex-start | flex-end | center | baseline;</span><br><span class="line"></span><br><span class="line">多根轴线对齐方式：拉伸对齐（默认） | 起点对齐 | 终点对齐 | 居中对齐 | 两端对齐 | 分散对齐</span><br><span class="line">align-content: stretch | flex-start | flex-end | center | space-between | space-around;</span><br></pre></td></tr></table></figure>
<h4 id="Flex项目属性-1"><a href="#Flex项目属性-1" class="headerlink" title="Flex项目属性"></a>Flex项目属性</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">顺序：数值越小越靠前，默认为0</span><br><span class="line">order: &lt;number&gt;; </span><br><span class="line"></span><br><span class="line">放大比例：默认为0，如果有剩余空间也不放大，值为1则放大，2是1的双倍大小，以此类推</span><br><span class="line">flex-grow: &lt;number&gt;; </span><br><span class="line"></span><br><span class="line">缩小比例：默认为1，如果空间不足则会缩小，值为0不缩小</span><br><span class="line">flex-shrink: &lt;number&gt;;</span><br><span class="line"></span><br><span class="line">项目自身大小：默认auto，为原来的大小，可设置固定值 50px/50%</span><br><span class="line">flex-basis: &lt;length&gt; | auto;</span><br><span class="line"></span><br><span class="line">flex-grow, flex-shrink 和 flex-basis的简写，默认值为0 1 auto</span><br><span class="line">两个快捷值：auto (1 1 auto) 和 none (0 0 auto)</span><br><span class="line">flex:none | [ &lt;&apos;flex-grow&apos;&gt; &lt;&apos;flex-shrink&apos;&gt;? || &lt;&apos;flex-basis&apos;&gt; ]</span><br><span class="line"></span><br><span class="line">项目自身对齐：继承父元素（默认） | 起点对齐 | 终点对齐 | 居中对齐 | 基线对齐 | 拉伸对齐</span><br><span class="line">align-self: auto | flex-start | flex-end | center | baseline | stretch;</span><br></pre></td></tr></table></figure>
<h3 id="兼容性"><a href="#兼容性" class="headerlink" title="兼容性"></a>兼容性</h3><p>flex主要经历了三个版本更新导致有很多兼容性问题</p>
<p><strong>2009 version标志：</strong>display: box; or a property that is box-{*} (eg. box-pack)</p>
<p><strong>2011 version标志：</strong>display: flexbox; or the flex() function or flex-pack property</p>
<p><strong>2012 version标志：</strong>display: flex/inline-flex; and flex-{*} properties</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br></pre></td><td class="code"><pre><span class="line">/* 子元素-平均分栏 */</span><br><span class="line">.flex1 &#123;</span><br><span class="line">    -webkit-box-flex: 1;      /* OLD - iOS 6-, Safari 3.1-6 */</span><br><span class="line">    -moz-box-flex: 1;         /* OLD - Firefox 19- */</span><br><span class="line">    /* width: 20%; */         /* For old syntax, otherwise collapses. */</span><br><span class="line">                              /* 见本文底部评论@Lawrence */</span><br><span class="line">    -webkit-flex: 1;          /* Chrome */</span><br><span class="line">    -ms-flex: 1;              /* IE 10 */</span><br><span class="line">    flex: 1;                  /* NEW, Spec - Opera 12.1, Firefox 20+ */</span><br><span class="line">&#125;</span><br><span class="line">/* 父元素-横向排列（主轴） */</span><br><span class="line">.flex-h &#123;</span><br><span class="line">    display: box;              /* OLD - Android 4.4- */</span><br><span class="line"></span><br><span class="line">    display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */</span><br><span class="line">    display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */</span><br><span class="line">    display: -ms-flexbox;      /* TWEENER - IE 10 */</span><br><span class="line">    display: -webkit-flex;     /* NEW - Chrome */</span><br><span class="line">    display: flex;             /* NEW, Spec - Opera 12.1, Firefox 20+ */</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    /* 09版 */</span><br><span class="line">    -webkit-box-orient: horizontal;</span><br><span class="line">    /* 12版 */</span><br><span class="line">    -webkit-flex-direction: row;</span><br><span class="line">    -moz-flex-direction: row;</span><br><span class="line">    -ms-flex-direction: row;</span><br><span class="line">    -o-flex-direction: row;</span><br><span class="line">    flex-direction: row;</span><br><span class="line">&#125;</span><br><span class="line">/* 父元素-横向换行 */</span><br><span class="line">.flex-hw &#123;</span><br><span class="line">    /* 09版 */</span><br><span class="line">    /*-webkit-box-lines: multiple;*/</span><br><span class="line">    /* 12版 */</span><br><span class="line">    -webkit-flex-wrap: wrap;</span><br><span class="line">    -moz-flex-wrap: wrap;</span><br><span class="line">    -ms-flex-wrap: wrap;</span><br><span class="line">    -o-flex-wrap: wrap;</span><br><span class="line">    flex-wrap: wrap;</span><br><span class="line">&#125;</span><br><span class="line">/* 父元素-水平居中（主轴是横向才生效） */</span><br><span class="line">.flex-hc &#123;</span><br><span class="line">    /* 09版 */</span><br><span class="line">    -webkit-box-pack: center;</span><br><span class="line">    /* 12版 */</span><br><span class="line">    -webkit-justify-content: center;</span><br><span class="line">    -moz-justify-content: center;</span><br><span class="line">    -ms-justify-content: center;</span><br><span class="line">    -o-justify-content: center;</span><br><span class="line">    justify-content: center;</span><br><span class="line">    /* 其它取值如下：</span><br><span class="line">        align-items     主轴原点方向对齐</span><br><span class="line">        flex-end        主轴延伸方向对齐</span><br><span class="line">        space-between   等间距排列，首尾不留白</span><br><span class="line">        space-around    等间距排列，首尾留白</span><br><span class="line">     */</span><br><span class="line">&#125;</span><br><span class="line">/* 父元素-纵向排列（主轴） */</span><br><span class="line">.flex-v &#123;</span><br><span class="line">    display: box;              /* OLD - Android 4.4- */</span><br><span class="line"></span><br><span class="line">    display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */</span><br><span class="line">    display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */</span><br><span class="line">    display: -ms-flexbox;      /* TWEENER - IE 10 */</span><br><span class="line">    display: -webkit-flex;     /* NEW - Chrome */</span><br><span class="line">    display: flex;             /* NEW, Spec - Opera 12.1, Firefox 20+ */</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    /* 09版 */</span><br><span class="line">    -webkit-box-orient: vertical;</span><br><span class="line">    /* 12版 */</span><br><span class="line">    -webkit-flex-direction: column;</span><br><span class="line">    -moz-flex-direction: column;</span><br><span class="line">    -ms-flex-direction: column;</span><br><span class="line">    -o-flex-direction: column;</span><br><span class="line">    flex-direction: column;</span><br><span class="line">&#125;</span><br><span class="line">/* 父元素-纵向换行 */</span><br><span class="line">.flex-vw &#123;</span><br><span class="line">    /* 09版 */</span><br><span class="line">    /*-webkit-box-lines: multiple;*/</span><br><span class="line">    /* 12版 */</span><br><span class="line">    -webkit-flex-wrap: wrap;</span><br><span class="line">    -moz-flex-wrap: wrap;</span><br><span class="line">    -ms-flex-wrap: wrap;</span><br><span class="line">    -o-flex-wrap: wrap;</span><br><span class="line">    flex-wrap: wrap;</span><br><span class="line">&#125;</span><br><span class="line">/* 父元素-竖直居中（主轴是横向才生效） */</span><br><span class="line">.flex-vc &#123;</span><br><span class="line">    /* 09版 */</span><br><span class="line">    -webkit-box-align: center;</span><br><span class="line">    /* 12版 */</span><br><span class="line">    -webkit-align-items: center;</span><br><span class="line">    -moz-align-items: center;</span><br><span class="line">    -ms-align-items: center;</span><br><span class="line">    -o-align-items: center;</span><br><span class="line">    align-items: center;</span><br><span class="line">&#125;</span><br><span class="line">/* 子元素-显示在从左向右（从上向下）第1个位置，用于改变源文档顺序显示 */</span><br><span class="line">.flex-1 &#123;</span><br><span class="line">    -webkit-box-ordinal-group: 1;   /* OLD - iOS 6-, Safari 3.1-6 */</span><br><span class="line">    -moz-box-ordinal-group: 1;      /* OLD - Firefox 19- */</span><br><span class="line">    -ms-flex-order: 1;              /* TWEENER - IE 10 */</span><br><span class="line">    -webkit-order: 1;               /* NEW - Chrome */</span><br><span class="line">    order: 1;                       /* NEW, Spec - Opera 12.1, Firefox 20+ */</span><br><span class="line">&#125;</span><br><span class="line">/* 子元素-显示在从左向右（从上向下）第2个位置，用于改变源文档顺序显示 */</span><br><span class="line">.flex-2 &#123;</span><br><span class="line">    -webkit-box-ordinal-group: 2;   /* OLD - iOS 6-, Safari 3.1-6 */</span><br><span class="line">    -moz-box-ordinal-group: 2;      /* OLD - Firefox 19- */</span><br><span class="line">    -ms-flex-order: 2;              /* TWEENER - IE 10 */</span><br><span class="line">    -webkit-order: 2;               /* NEW - Chrome */</span><br><span class="line">    order: 2;                       /* NEW, Spec - Opera 12.1, Firefox 20+ */</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>参考资料：<a href="http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html" target="_blank" rel="noopener">Flex 布局教程：语法篇</a>、<a href="http://www.ruanyifeng.com/blog/2015/07/flex-examples.html" target="_blank" rel="noopener">Flex 布局教程：实例篇</a>、<a href="http://www.ayqy.net/blog/flexbox%E5%B8%83%E5%B1%80%E7%9A%84%E5%85%BC%E5%AE%B9%E6%80%A7/" target="_blank" rel="noopener">flexbox布局的兼容性</a>、<a href="https://www.w3cplus.com/css3/using-flexbox.html" target="_blank" rel="noopener">使用Flexbox：新旧语法混用实现最佳浏览器兼容</a></p>
      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center">
  <div>Donate comment here</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechatpay.jpg" alt="Tony 微信支付">
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/alipay.jpg" alt="Tony 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2015/04/08/虚拟DOM/" rel="next" title="虚拟DOM">
                <i class="fa fa-chevron-left"></i> 虚拟DOM
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2015/04/08/nginx配置/" rel="prev" title="nginx配置">
                nginx配置 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Tony</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives">
              
                  <span class="site-state-item-count">65</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">18</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">3</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#内容"><span class="nav-number">1.</span> <span class="nav-text">内容</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Flex介绍"><span class="nav-number">2.</span> <span class="nav-text">Flex介绍</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#基本概念"><span class="nav-number">3.</span> <span class="nav-text">基本概念</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#CSS属性说明"><span class="nav-number">4.</span> <span class="nav-text">CSS属性说明</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#Flex项目属性"><span class="nav-number">4.1.</span> <span class="nav-text">Flex项目属性</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Flex项目属性-1"><span class="nav-number">4.2.</span> <span class="nav-text">Flex项目属性</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#兼容性"><span class="nav-number">5.</span> <span class="nav-text">兼容性</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2015 &mdash; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Tony</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  



  
  









  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three-waves.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>